package com.java复习.jdbc.游戏.demo3;

/**
 * 物品类
 */
public class Article {
    private int id;
    private String name;
    private int ATK;
    private int DEF;
    private int MP;
    private int HP;
    private int num;
    private int price;

    public Article(int id, String name, int ATK, int DEF, int MP, int HP, int num, int price) {
        this.id = id;
        this.name = name;
        this.ATK = ATK;
        this.DEF = DEF;
        this.MP = MP;
        this.HP = HP;
        this.num = num;
        this.price = price;
    }

    public Article() {
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getATK() {
        return ATK;
    }

    public void setATK(int ATK) {
        this.ATK = ATK;
    }

    public int getDEF() {
        return DEF;
    }

    public void setDEF(int DEF) {
        this.DEF = DEF;
    }

    public int getMP() {
        return MP;
    }

    public void setMP(int MP) {
        this.MP = MP;
    }

    public int getHP() {
        return HP;
    }

    public void setHP(int HP) {
        this.HP = HP;
    }

    public int getNum() {
        return num;
    }

    public void setNum(int num) {
        this.num = num;
    }

    public int getPrice() {
        return price;
    }

    public void setPrice(int price) {
        this.price = price;
    }

    @Override
    public String toString() {
        return "Article{" +
                "id=" + id +
                ", name='" + name + '\'' +
                ", ATK=" + ATK +
                ", DEF=" + DEF +
                ", MP=" + MP +
                ", HP=" + HP +
                ", num=" + num +
                ", price=" + price +
                '}';
    }

    public void play(User user){
        user.setATK(user.getATK()+this.getATK());
        user.setDEF(user.getDEF()+this.getDEF());
        user.setHP(user.getHP()+this.getHP());
        user.setMP(user.getHP()+this.getHP());
        this.num--;
    }
}
